home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr37 / u3200.zip / U3.DOC < prev    next >
Text File  |  1995-03-26  |  46KB  |  1,116 lines

  1.  
  2.  
  3.  
  4.                             User Updater--Universal
  5.  
  6.                          Copyright 1995 by Thomas Almy
  7.  
  8.                                TABLE OF CONTENTS
  9.  
  10.  
  11.      INTRODUCTION  ...........................                            2
  12.           WARRANTEE  ..........................                           2
  13.           DISTRIBUTION .........................                          3
  14.           USER UPDATER -- UNIVERSAL IS SHAREWARE ............             3
  15.           TRADEMARKS ..........................                           3
  16.  
  17.      RUNNING USER UPDATER -- UNIVERSAL .................                  4
  18.           USERBASE MODE  ........................                         4
  19.           DOOR MODE  ..........................                           5
  20.  
  21.      USER UPDATER COMMAND FILE .....................                      6
  22.           OPPERANDS: FIELDS AND NUMBERS  ................                 7
  23.           EXPRESSIONS  .........................                          9
  24.           LET STATEMENT  ........................                        10
  25.           PRINT STATEMENT  .......................                       10
  26.           SET STATEMENT  ........................                        11
  27.           RUN STATEMENT  ........................                        12
  28.           RETURN STATEMENT .......................                       13
  29.           THE OPTIONAL "FINALLY" COMMAND ................                13
  30.  
  31.      ERROR MESSAGES  ..........................                          14
  32.  
  33.      EXAMPLES OF USE ..........................                          16
  34.           RESET A FLAG .........................                         16
  35.           DELETING NON-VERIFIED CALLERS  ................                16
  36.           RAISING LEVELS AND POSTING MESSAGES  .............             17
  37.           LOW CREDITS WARNING  .....................                     17
  38.           LIST AND TALLY TERMINAL EMULATIONS ..............              17
  39.           NOTIFY XMODEM USERS  .....................                     18
  40.           POSTS PER MONTH RATIO LIST ..................                  18
  41.           POST PER DOWNLOAD RATIO DOOR .................                 18
  42.           TIME PURCHASE DOOR ......................                      19
  43.           GENDER BASED DOOR  ......................                      19
  44.           NIGHTLY MAINTENANCE AT BITTER BUTTER BETTER BBS  .......       20
  45.  
  46.      TECHNICAL NOTES ..........................                          21
  47.  
  48.      OTHER UTILITIES BY THE AUTHOR OF U3 ................                22
  49.  
  50.  
  51.      User Updater -- Universal                                            2
  52.  
  53.  
  54.  
  55.                                   INTRODUCTION
  56.  
  57.      The User Updater--Universal (or U3) program performs userbase
  58.      maintenance in RemoteAccess 2.0x BBSes.  Unlike other userbase
  59.      maintenance programs, U3 provides virtually unlimited test conditions
  60.      and actions.  Conditions can be based on any combinations of date,
  61.      flag, and numeric field values.  When the condition is true, any
  62.      number of fields can be modified, information can be printed, and/or
  63.      external programs (such as robotic mailers) can be executed, and U3's
  64.      own return error level code can be set.  Almost every field in the
  65.      userbase can be examined.
  66.  
  67.      Ten "global fields" can be used to store values, allowing the program
  68.      to do such things as count the number of callers meeting a specific
  69.      criteria or to calculate the average caller age.
  70.  
  71.      In addition, U3 can be used in a type 7 or 15 menu item (door) to
  72.      perform the same set of operations on the current logged in user. This
  73.      is called "door mode."
  74.  
  75.      U3 can be readily combined with other programs in batch files. The use
  76.      of U3 is virtually limited only by your imagination!
  77.  
  78.      Sysops who have had some programming experience in a language like
  79.      BASIC or Pascal will find U3 easy to use. Those without experience
  80.      should study closely the examples at the end of the instructions.
  81.  
  82.      I wrote U3 because I found myself using several custom programs to do
  83.      userbase maintenance, and it made sense to me to have a program which
  84.      could do all modifications.  I hope you'll find it as useful as I have
  85.      and will register!
  86.  
  87.      **** WARRANTEE
  88.  
  89.      User Updater Universal (U3) is provided "AS IS" with no warranties or
  90.      guarantees of any kind.  Since U3 is distributed as fully functional
  91.      shareware, it is the responsibility of the potential purchaser to
  92.      determine that U3 is suitable for use before purchasing.  The author
  93.      does not make any claims, promises, or guarantees as to the usability
  94.      of U3 for any particular purpose and cannot and does not accept any
  95.      responsibility for system damage, loss of profit, or any other
  96.      special, incidental or consequential damages resulting from this
  97.      product.
  98.  
  99.      The author has taken care in writing this program, however U3 by its
  100.      very nature is capable of destroying or modifying data.  The user
  101.      should always back up the BBS userbase files prior to testing U3 or
  102.      modifying any U3 command files.
  103.  
  104.  
  105.      User Updater -- Universal                                            3
  106.  
  107.  
  108.  
  109.      **** DISTRIBUTION
  110.  
  111.      U3 may be distributed by anyone as long as the files in the original
  112.      archive are intact. U3 may not be distributed as part of a commercial
  113.      product or by any means that implies that it is a registered (paid
  114.      for) copy without permission of the author.
  115.  
  116.      **** USER UPDATER -- UNIVERSAL IS SHAREWARE
  117.  
  118.      You may use User Updater to evaluate it for your needs. If you decide
  119.      it is useful to you, then you must register, otherwise you must
  120.      discontinue its use. Registration is an easily affordable $10. See the
  121.      file REGISTER.DOC for instructions.
  122.  
  123.      Registrations may not be transferred. They are are specific to a
  124.      single BBS name.
  125.  
  126.      Once registered the modest nag screen, beeps and delays will vanish.
  127.      However the unregistered program is fully functional.
  128.  
  129.      **** TRADEMARKS
  130.  
  131.      All product names mentioned in this document are trademarks of their
  132.      respective manufacturers.
  133.  
  134.  
  135.      User Updater -- Universal                                            4
  136.  
  137.  
  138.  
  139.                        RUNNING USER UPDATER -- UNIVERSAL
  140.  
  141.      **** USERBASE MODE
  142.      To run U3 you need to create a command file telling U3 what it needs
  143.      to do.  The syntax for this file is described in the next section.
  144.      For accessing the user base, you must have the environment variable RA
  145.      set to the directory containing the CONFIG.RA file, or else you must
  146.      run U3 from the directory containing CONFIG.RA.  Then run U3 from the
  147.      command line:
  148.  
  149.          u3 -d -f commandFile RegistrationNumber
  150.  
  151.      where:
  152.  
  153.      -d and -f are optional command switches.
  154.  
  155.      commandFile is the name (and path if not in the current directory) of
  156.           the U3 command file.
  157.  
  158.      RegistrationNumber is optional and is the number provided when you
  159.           register U3.  Until registered, U3 has an annoying delay which
  160.           can be bypassed only by hitting a key.  This allows U3 to be
  161.           fully tested but not be easily used in an automated environment.
  162.  
  163.      The registration number can also be placed as the single line in a
  164.      text file called U3.KEY, and placed in the current directory. This
  165.      eliminates the need to place the registration number on the command
  166.      line.
  167.  
  168.      If "-d" is used as the first argument, U3 runs in debug mode and will
  169.      not modify the userbase or run external programs.  Instead it displays
  170.      what it would have done if the -d option was not given.  If "-f" is
  171.      used, the userbase will not be modified, but all other actions occur.
  172.  
  173.      If no command liine switches are used, U3 will not run if a copy of
  174.      RemoteAccess is running.  It is important that U3 only be used when
  175.      RemoteAccess is not running, such as during night-time maintenance. If
  176.      you are not interested in modifying the userbase, U3 can be run when
  177.      RemoteAccess is running by using the -f option.  When debug mode (the
  178.      -d option) is used, U3 will always run so that command files can be
  179.      tested without stopping RemoteAccess.
  180.  
  181.      You should always test U3 command files by using debug mode. Be
  182.      certain that U3 will do exactly what you want before removing the -d
  183.      option. You should also save a copy of USERS.BBS before testing U3. U3
  184.      is a very powerful program, and is very capable of totally mangling
  185.      your user base given the wrong commands!
  186.  
  187.      The first thing U3 will do is open the CONFIG.RA and USERS.BBS files.
  188.      It will give an error message and quit if it cannot find either of
  189.      these files.  Then U3 will open and parse the command file.  If any
  190.      error is encountered, a message will be printed and execution will
  191.      stop. Only one error will be reported in any run. Errors during
  192.  
  193.  
  194.      User Updater -- Universal                                            5
  195.  
  196.  
  197.  
  198.      parsing describe the error and the location in the command file where
  199.      the error was discovered.
  200.  
  201.      U3's print statements write to the display.  The output can be
  202.      directed to a file using DOS's output redirection.  For example:
  203.  
  204.          u3 u3cmd.txt c:\ra 12345 >u3out.txt
  205.  
  206.      will write the output to U3OUT.TXT.  You can then use a robotic mailer
  207.      to send the output to you as mail, or can use the output file in an
  208.      online bulletin.
  209.  
  210.      U3 can be invoked as many times as is desired, using different command
  211.      files each time.  This gives maximum flexibility.
  212.  
  213.      **** DOOR MODE
  214.  
  215.      U3 can also be used in Door Mode. In this case it is either invoked
  216.      from a type 7 menu item, or from a batch file run from a type 7 or 15
  217.      menu item.  To run U3 in Door Mode, and access the record of the
  218.      current user online, invoke U3:
  219.  
  220.          u3 -u -d -f commandFile
  221.  
  222.      The -d and -f are optional command flags, as described previously.
  223.  
  224.      U3 must be run in the directory containing the EXITINFO.BBS file. The
  225.      registration number is not necessary. There is no annoying nag screens
  226.      in Door Mode when not registered.  The user database is not touched,
  227.      so other lines of RemoteAccess can be running.  Changes made to the
  228.      exitinfo record are incorporated into the user record when
  229.      RemoteAccess is re-entered.  The EXITINFO.BBS file has more
  230.      information than the userbase record.  These additional fields can be
  231.      accessed and, with care, altered.  Operation in Door Mode is otherwise
  232.      identical with Userbase mode.
  233.  
  234.      See the end of this document for complete usage examples.
  235.  
  236.  
  237.      User Updater -- Universal                                            6
  238.  
  239.  
  240.  
  241.                            USER UPDATER COMMAND FILE
  242.  
  243.      The command file is the heart of U3.  In it you describe the actions
  244.      you want U3 to perform.  The file is a standard ASCII text file you
  245.      can create with DOS's EDIT or EDLIN programs or any other editor which
  246.      will create text files (TED, QEDIT, Brief, Epsilon...).
  247.  
  248.      To make things easier, U3 ignores line breaks, has no limits on line
  249.      sizes, and ignores case.  You can put comments in the command file:
  250.      put a \ character in a line and everything to the right until the end
  251.      of the line will be ignored.
  252.  
  253.      The command file consists of one or more IF THEN commands, with the
  254.      format:
  255.  
  256.          IF expression THEN statements
  257.  
  258.      where
  259.  
  260.      expression is a logical expression (described later)
  261.  
  262.      and
  263.  
  264.      statements are one or more statements which are to be executed if the
  265.           expression has a non-zero ("true") value.
  266.  
  267.      There are five types of statements.  LET statements alter numeric and
  268.      date fields in the record, SET statements alter text fields in the
  269.      record, PRINT statements print data to the display or file, RUN
  270.      statements execute external programs, and RETURN statements set U3's
  271.      return code.
  272.  
  273.      Each user record is examined in turn, for each IF expression that is
  274.      true, the THEN statements are executed for that user record. Each IF
  275.      THEN command is independent -- whether or not an IF expression is
  276.      true, the following IF THEN command is executed. Commands and the
  277.      statements within are all executed sequentially. If a field is set by
  278.      a LET statement, the new field value will be used if later referenced
  279.      in the command file. Consider the following command file:
  280.  
  281.          IF level=10        \ A new caller
  282.          THEN
  283.             LET level = 20
  284.             LET D1 = 1
  285.             PRINT "New user ", name
  286.             RETURN 20
  287.          IF level=20 & today-lastdate > 30 & !nokill
  288.          THEN \ delete this caller
  289.             LET deleted = 1
  290.             PRINT "User ", name, " deleted"
  291.  
  292.      Each user record will be examined.  If the user security level is 10,
  293.      then the level will be changed to 20, the D1 flag set, and a
  294.  
  295.  
  296.      User Updater -- Universal                                            7
  297.  
  298.  
  299.  
  300.      notification printed.  The return code will be 20 if there are any new
  301.      callers.  If the security level is 20 and the user hasn't called
  302.      within the past 30 days (difference between the today's date and the
  303.      last call date greater than 30), and the nokill flag is not set then
  304.      mark the user as deleted and print the message.
  305.  
  306.      Since the commands are executed sequentially, any user with security
  307.      level of 10 who hasn't called in thirty days will end up being
  308.      deleted.  Why? Because their level is raised to 20 by the first IF
  309.      THEN command, so the level is 20 in the IF expression of the second IF
  310.      THEN command. If this were a problem, the order of the two IF THEN
  311.      commands could be reversed. However in this particular example it is
  312.      unlikely that a new user would not have called in the last thirty
  313.      days.
  314.  
  315.      This example was formatted and capitalized to aid in reading, however
  316.      remember that the U3 program ignores line breaks and capitalization.
  317.  
  318.      **** OPPERANDS: FIELDS AND NUMBERS
  319.  
  320.      Numeric expressions consists of operators (such as add and subtract)
  321.      and opperands.  Opperands can either be the names of fields in the
  322.      userbase (or EXITINFO.BBS in Door mode), or numbers.
  323.  
  324.      A number is either an integer (examples: 0 123 6120) or a floating
  325.      point number (examples 1.3  2.4 222.111).
  326.  
  327.      When a numeric field name is used in an expression, the value
  328.      contained in the user record being examined is used in the calculation
  329.      at that spot.  Numeric fields are of different sizes and types,
  330.      however all field contents are converted to floating point numbers for
  331.      calculations.
  332.  
  333.      Some fields are described as "calculated value." These are not real
  334.      fields in the record, but are values calculated from fields or outside
  335.      information (such as today's date).
  336.  
  337.      Valid numeric fields are (those marked with "+" are for Door Mode
  338.      only):
  339.  
  340.      ** dates:
  341.      birthdate -- date of birth
  342.      firstdate -- date of first call
  343.      lastdate -- date of last call
  344.      subdate -- subscription date
  345.      today -- today's date (calculated value, not in userbase!)
  346.  
  347.      ** flags: value 1 if true, 0 if false
  348.      hasalias -- alias and name fields are the same (calculated value)
  349.      deleted -- deleted flag
  350.      cls -- clear screen flag
  351.      more -- more prompt flag
  352.      ansi -- ANSI mode flag
  353.  
  354.  
  355.      User Updater -- Universal                                            8
  356.  
  357.  
  358.  
  359.      nokill -- no-kill flag
  360.      xfer -- xfer priority flag
  361.      fsedit -- full screen editor flag
  362.      quiet -- quiet mode flag
  363.      hotkeys -- hotkeys flag
  364.      avt0 -- avt/0 emulation flag
  365.      fsmsg -- full screen message viewer flag
  366.      hidden -- hidden from userlist flag
  367.      page -- page priority flag
  368.      noecho -- no echomail in mailbox scan flag
  369.      guest -- guest account flag
  370.      postbill -- post bill enabled flag
  371.      a1, a2, a3, a4, a5, a6, a7, a8,
  372.      b1, b2, b3, b4, b5, b6, b7, b8,
  373.      c1, c2, c3, c4, c5, c6, c7, c8,
  374.      d1, d2, d3, d4, d5, d6, d7, d8 -- user flags
  375.  
  376.      ** Integers (these have values in range roughly +/- 2,000,000,000)
  377.      credit -- credits
  378.      pending -- pending charges
  379.      numcalls -- number of calls
  380.      uploads -- number of uploads
  381.      downloads -- number of downloads
  382.      uploadk -- kilobytes of uploads
  383.      downloadk -- kilobytes of downloads
  384.      todayk -- kilobytes of downloads today
  385.  
  386.      ** Integers (these have signed values -32768 to 32767)
  387.      elapsed -- elapsed time today (negative times are possible when time
  388.           banks are used)
  389.      + deductedtime -- (don't know what this field does)
  390.  
  391.      ** Integers (these have non-negative values 0 to 65535)
  392.      age -- caller's age (calculated value, if birthdate field is empty,
  393.           the age is returned as 0)
  394.      msgpost -- number of messages posted
  395.      level -- security level
  396.      length -- screen length
  397.      group -- group member (0 if not used)
  398.      + baud -- login speed, 0 for local
  399.      + timelimit -- number of remaining minutes for this call
  400.      + pages -- number of paging attempts for this call
  401.      + dlimit -- download limit for this call
  402.  
  403.      ** Integers (these have non-negative values 0 to 255)
  404.      pwdchange -- calls since last password change.  This value rolls over
  405.           from 255 to 0 so is not accurate unless password changing is
  406.           enforced.
  407.      dobcheck -- calls since last date of birth check.  This value rolls
  408.           over from 255 to 0 so is not accurate unless checking is
  409.           enforced.
  410.      language -- language number selected (0 if not used)
  411.  
  412.  
  413.      User Updater -- Universal                                            9
  414.  
  415.  
  416.  
  417.      dateformat -- selected date format: 1- DD-MM-YY, 2- MM-DD-YY, 3- YY-
  418.           MM-DD, 4- DD-Mmm-YY.
  419.      sex -- sex: 0-unknown, 1-male, 2-female
  420.      protocol -- default download protocol (ASCII character value, 0 means
  421.           not specified)
  422.      + netmail -- 0-no outgoing netmail, 1-outgoing netmail
  423.      + echomail -- 0-no outgoing echomail, 1-outgoing echomail
  424.      + wantchat -- 0-doesn't want to chat, 1-wants to chat
  425.      + errorfree -- 0-no REQ or ARQ, 1- error correcting connect
  426.      + sysopnext -- 0-not set, 1-sysop on next (ALT-N from console)
  427.      + emsi -- 0-normal session, 1-IEMSI session
  428.      + doesavt -- 0-doesn't do AVATAR, 1-does AVATAR
  429.      + ripmode -- 0-doesn't do RIP, 1-does RIP
  430.  
  431.      Note that all dates are treated as integer values and are the number
  432.      of days since February 28, 1900.  Dates of January and February 1900
  433.      are not allowed and are treated as March 1, 1900.  If a date field is
  434.      blank, the value 0 is supplied.  All years are assumed to be in the
  435.      range 1900 to 1999.
  436.  
  437.      In addition there are 10 global integer fields, which can hold values
  438.      in range +/- 2,000,000,000 named u1, u2, ..., u10.  These fields are
  439.      not associated with a particular user record, and can be used to
  440.      accumulate totals, count users, or as general temporary storage
  441.      locations.  The global fields initially have the value 0.
  442.  
  443.      **** EXPRESSIONS
  444.  
  445.      Expressions are traditional mathematical expressions.  Standard order
  446.      of precedence rules are followed.  I.E. multiplication is performed
  447.      before addition in the expression 2+3*5.  Otherwise execution proceeds
  448.      from left to right.  Operators in decreasing precedence order are:
  449.  
  450.      -    Unary minus (negate)
  451.      + -  Addition and Subtraction
  452.      * /  Multiplication, division
  453.      = != < <= > >= Equal, not equal, less, less or equal, greater, greater
  454.           or equal. Return a "true" value one or "false" value zero.
  455.      !    Not (logical complement-- nonzero or true values become zero or
  456.           false, and visa versa)
  457.      &    And (value true if both arguments true or non-zero)
  458.      |    Or (value true if either argument true or non-zero)
  459.  
  460.      In the expression 2+3*5, the multiplication is done before the
  461.      addition because multiplication has higher precedence.  Parentheses
  462.      can be used to change the order of evaluation.  For instance (2+3)*5
  463.      will do the addition first.  All calculations are done in floating
  464.      point with 15 digits precision.
  465.  
  466.      Note that the expression age>=18 will be true if the age of the caller
  467.      is greater than or equal to 18. However 30>=age>=18 will not return
  468.      true for ages between 18 and 30. This must be done with two
  469.      comparisons and the "and" operator: 30>=age&age>=18. The order of
  470.  
  471.  
  472.      User Updater -- Universal                                           10
  473.  
  474.  
  475.  
  476.      precedence has the comparisons done before the and operator, so no
  477.      parenthesis are necessary.
  478.  
  479.      Most expressions will be simple comparisons, or multiple comparisons
  480.      connected with the and operator. In this case, all the comparisons
  481.      must be true for the expression to be true. For example the expression
  482.      age>16 & !nokill & level=30  will be true only if all of the following
  483.      are true: age greater than 16, nokill flag *not* true, and security
  484.      level equal to 30.
  485.  
  486.  
  487.      **** LET STATEMENT
  488.  
  489.      The LET statement is used to assign new values to most numeric and
  490.      date fields.  The syntax is:
  491.  
  492.          LET field = expression
  493.  
  494.      where field is a valid assignment field and expression is any valid
  495.      expression.  If the field is a flag, then any nonzero expression value
  496.      is considered to be TRUE, while a zero value is considered to be
  497.      false. For integer fields, the expression value, calculated in
  498.      floating point, is converted to the next lower integer value. For
  499.      instance, 5/2 would be stored as 2.
  500.  
  501.      All fields listed above, except for "today", "hasalias", and "age" are
  502.      valid for assignments, however most of them probably should not be
  503.      used for assignments.  Use this statement with caution! When assigning
  504.      to date fields, the value assigned should be a date (e.g. "LET
  505.      subdate=today").  Be careful not to assign invalid values as no
  506.      checking is performed. This includes storing a negative value in a
  507.      field which only holds non-negative values.
  508.  
  509.      **** PRINT STATEMENT
  510.  
  511.      The print statement prints to the display or to a file if output is
  512.      redirected, as described earlier.  The syntax is:
  513.  
  514.           PRINT printExpressions
  515.  
  516.      where printExpressions are expressions, quoted text, or text field
  517.      names. All printExpressions must be separated by commas.
  518.  
  519.      Each print statement prints a single line of data.  Numeric
  520.      expressions print as integers.  Literal text can be printed by
  521.      enclosing it in quotes (e.g. "a string").  To print a quote character,
  522.      use two adjacent quote characters (e.g. " "" " will print as a space-
  523.      quote-space sequence).  Text fields in the userbase can be printed as
  524.      follows (those marked with "+" are available in Door Mode only):
  525.  
  526.      name -- user name
  527.      location -- location
  528.      organization -- organization (field not used in RemoteAccess)
  529.  
  530.  
  531.      User Updater -- Universal                                           11
  532.  
  533.  
  534.  
  535.      address1 -- address1
  536.      address2 -- address2
  537.      address3 -- address3
  538.      handle -- handle
  539.      comment -- comment
  540.      dataphone -- data phone
  541.      voicephone -- voice phone
  542.      forwardto -- name to forward mail to
  543.      + emsicrt -- IEMSI CRT field
  544.      + emsiproto -- IEMSI PROTOCOL field
  545.      + emsiable -- IEMSI CAPABILITIES field
  546.      + emsireq -- IEMSI REQUEST field
  547.      + emsisoft -- IEMSI SOFTWARE field
  548.      + pagereason -- paging reason
  549.  
  550.      There is some control possible over formatting.  To print a numeric
  551.      value as a date, follow the expression with ":d".  If the date value
  552.      is 0 (meaning "not set"), the date printed will be "  -  -  ".
  553.  
  554.      To specify a fixed number of columns for a field, follow the
  555.      expression with ":n" where n is an integer specifying the number of
  556.      columns. Text fields will be left justified and truncated if
  557.      necessary, while numeric fields will be right justified and are never
  558.      truncated if the specified field length is too short.
  559.  
  560.      For instance:
  561.  
  562.       PRINT "Name birthdate, and age:",name:20,"  ",birthdate:d, age:3
  563.  
  564.      Will print the text "Name and age:" (without the quotes), the first 20
  565.      characters in the name, padded if necessary on the right with spaces,
  566.      two spaces, the birthdate of the caller, and the age in years of the
  567.      caller right justified in a 3 column field.
  568.  
  569.      The length of the line printed is limited to about 250 characters.
  570.  
  571.      You can print a blank line with the statement:
  572.  
  573.          PRINT ""
  574.  
  575.  
  576.      **** SET STATEMENT
  577.  
  578.      The SET statement is used to assign values to text fields.
  579.  
  580.      The syntax of the set statement is:
  581.  
  582.          SET textField = printExpressions
  583.  
  584.      where textField is a text field name listed under the PRINT statement,
  585.      and printExpressions are expressions, quoted text, and text field
  586.      names separated by commas, as described under the PRINT statement.
  587.  
  588.  
  589.      User Updater -- Universal                                           12
  590.  
  591.  
  592.  
  593.      For example, the handle can be set to the callers real name with the
  594.      statement:
  595.  
  596.          SET handle = name
  597.  
  598.      If the printExpressions would create text which would not fit in the
  599.      field, the text is truncated (from the right) to fit.
  600.  
  601.      **** RUN STATEMENT
  602.  
  603.      The RUN statement works just like the print statement, except the
  604.      generated line of text is used as a command line.  The line to be
  605.      executed may not be more than 124 characters long.  For instance, a
  606.      message can be sent to the user using mbutil (part of GEcho mail
  607.      tosser) with:
  608.  
  609.       RUN "mbutil msg.txt #1 -To """, name, """ -Subject Welcome -Pvt"
  610.  
  611.      For the user Joe Blow, this would run the command:
  612.  
  613.          mbutil msg.txt #1 -To "Joe Blow" -Subject Welcome -Pvt
  614.  
  615.      The RUN command uses Ralf Brown's SPAWNO library so that U3 is swapped
  616.      out of low memory to run the program.  U3 will swap out to XMS if
  617.      available, else EMS.  If neither is available, U3 will swap to disk.
  618.  
  619.      U3 uses the command interpreter (usually COMMAND.COM) in the RUN
  620.      command, so the user path is searched and batch programs (BAT
  621.      extensions) are allowed.  Users of JP Software's 4DOS can run BTM
  622.      files and aliases as well.  However if the program to run is an EXE or
  623.      COM file, and the full path and filename is specified, then the
  624.      program will be run directly without starting a command interpreter.
  625.      This is faster, and conserves memory.  For instance:
  626.  
  627.          RUN "foo bar"
  628.  
  629.      will run program foo, which can be an EXE, COM, or BAT file located
  630.      anywhere in the search path.  A copy of the command interpreter will
  631.      be started to run the program.  The statement:
  632.  
  633.          RUN "\xyz\foo bar"
  634.  
  635.      will run program foo, which can be an EXE, COM or BAT file, but must
  636.      be in directory \xyz\.  A copy of the command interpreter will be
  637.      started to run the program.  On the other hand:
  638.  
  639.          RUN "\xyz\foo.exe bar"
  640.  
  641.      will run program foo.exe in directory \xyz\ without starting a command
  642.      interpreter.
  643.  
  644.  
  645.      User Updater -- Universal                                           13
  646.  
  647.  
  648.  
  649.      **** RETURN STATEMENT
  650.  
  651.      The syntax of the RETURN statement is:
  652.  
  653.          RETURN expression
  654.  
  655.      where expression is any valid expression.
  656.  
  657.      The return statement sets the return error level of U3 to the value of
  658.      thee expression. The last RETURN statement executed determines the
  659.      value used. The return level cannot be less than 0 or greater than
  660.      255. If no RETURN statement is executed, then the level 0 is returned.
  661.      If an error occurs while running U3, the level 1 is returned. The
  662.      error level can be examined in a DOS batch file by using the IF
  663.      ERRORLEVEL statements. If you use 4DOS, you can examine, print, or
  664.      even evaluate expressions based on the level.
  665.  
  666.      **** THE OPTIONAL "FINALLY" COMMAND
  667.  
  668.      At the end of the IF THEN commands which are executed for every user
  669.      record there can be a single FINALLY followed by more IF commands.
  670.      These final IF THEN commands are executed after all user records are
  671.      processed.  No record fields can be accessed, only the global fields
  672.      U1 through U10.  This feature is typically used to print accumulated
  673.      results.  Consider this command file that calculates the average age
  674.      of callers in security level 20:
  675.  
  676.        IF AGE > 0 & LEVEL = 20 \ if age is zero, birthdate is unknown!
  677.        THEN
  678.          LET U1 = U1 + AGE     \ sum of ages in U1
  679.          LET U2 = U2 + 1       \ number of users in U2
  680.        FINALLY \ calculate this at the end
  681.        IF U2 > 0               \ must be at least one to average
  682.        THEN
  683.          PRINT "Average age is ", U1/U2
  684.  
  685.      The sum of the ages is stored in global field U1 and the number of
  686.      users in global field U2.  After all records are examined, the average
  687.      age, U1/U2, is printed.
  688.  
  689.  
  690.      User Updater -- Universal                                           14
  691.  
  692.  
  693.  
  694.                                  ERROR MESSAGES
  695.  
  696.      U3 can generate the following error messages. The first error will
  697.      cause the program to terminate, returning an error level 1.
  698.  
  699.      "could not access EXITINFO.BBS" -- In Door Mode, the EXITINFO.BBS file
  700.      must be in the current directory.
  701.  
  702.      "could not access CONFIG.RA" -- The RA environment variable must be
  703.      set to the directory containing CONFIG.RA, or CONFIG.RA must be in the
  704.      current directory.
  705.  
  706.      "could not read CONFIG.RA" -- This error can occur if another program
  707.      is accessing the configuration file and has it locked.
  708.  
  709.      "could not access USERS.BBS" -- This error can occur if another
  710.      program is accessing the userbase, such as a running copy of
  711.      RemoteAccess. You might want to try the -f command option.
  712.  
  713.      "could not open command file" -- The command file could not be found.
  714.  
  715.      "insufficient memory for code array" -- Not enough memory to run U3.
  716.      U3 needs about 150k bytes to run.
  717.  
  718.      "defective EXITINFO.BBS" -- in Door Mode, there was something funny
  719.      about the EXITINFO.BBS file.
  720.  
  721.      "strange symbol reference" -- program bug, please send command file to
  722.      U3 author!
  723.  
  724.      "WARNING: Attempted record write denied" -- when using the -f command
  725.      option, a LET or SET statement was encountered that attempted to
  726.      modify the record. This warning message does not abort execution, but
  727.      simply leaves the record unaltered.
  728.  
  729.      The following are FATAL COMPILATION ERRORS. These are generated
  730.      because of errors in the command file. The error message will indicate
  731.      the line number and column where the error was discovered.
  732.  
  733.      "text string not terminated before end of line" -- text strings cannot
  734.      wrap around line boundaries. The command file is probably missing a
  735.      closing quote.
  736.  
  737.      "unrecognized control character" -- only carriage return, line feed,
  738.      and tab control (non printing) characters are allowed in commands.
  739.  
  740.      "text string too long" -- text strings cannot be longer than 127
  741.      characters.
  742.  
  743.      "invalid number format" -- numbers must only consist of digits 0
  744.      through 9, and an optional single decimal point.
  745.  
  746.  
  747.      User Updater -- Universal                                           15
  748.  
  749.  
  750.  
  751.      "unidentified symbol name" -- the indicated keyword or field name is
  752.      either mis-spelled or not allowed (non-global field names after the
  753.      FINALLY keyword, or Door Mode fields when not in Door Mode).
  754.  
  755.      "U3 command file too big" -- the command file, when encoded, must be
  756.      less than 10,000 bytes. This command file is too big. More likely than
  757.      not the problem is too much text. If this is a problem, notify the
  758.      author, who can increase this size in future versions.
  759.  
  760.      "right parenthesis expected" -- an expression is missing a closing
  761.      right parenthesis.
  762.  
  763.      "expression cannot involve text field" -- only numeric values can be
  764.      used in expressions.
  765.  
  766.      "field name expected" -- something other than a valid field name was
  767.      found where a field name was expected.
  768.  
  769.      "expression too complex" -- you need to simplify this expression.
  770.      Expressions can only have 31 simultaneous subexpression results during
  771.      a calculation. This is actually a very large number. Try rearranging
  772.      the expression so execution can proceed left to right.
  773.  
  774.      "text field name required" -- in SET statement. You probably want the
  775.      LET statement.
  776.  
  777.      ""=" expected" -- in SET or LET statement, you need an "=".
  778.  
  779.      "integer constant expected" -- field sizes must be integer constants.
  780.  
  781.      "constant too large" -- field sizes must not be bigger than 254.
  782.  
  783.      "assignable field name required" -- in LET statement, field name give
  784.      was not assignable (such as "age" or a text field).
  785.  
  786.      "THEN expected" -- the keyword THEN must be used after the IF
  787.      expression but before the LET, SET, RUN, PRINT, or RETURN statements.
  788.  
  789.      "unexpected token" -- catch-all error. U3 expected a possible end of
  790.      command file, but there was more in the file. Common causes are a
  791.      missing commas or keywords (LET, SET, RUN, PRINT, RETURN).
  792.  
  793.  
  794.      User Updater -- Universal                                           16
  795.  
  796.  
  797.  
  798.                                 EXAMPLES OF USE
  799.  
  800.      This section describes a number of U3 command files, showing a variety
  801.      of functions that can be performed.
  802.  
  803.  
  804.      **** RESET A FLAG
  805.  
  806.      The first example uses U3 to reset a flag. It represents a "quicky"
  807.      command file that might be written and used once to handle a one-time
  808.      maintenance task:
  809.  
  810.        if 1 then let a1=0
  811.  
  812.      That's it. Since "1" is always true, flag a1 gets reset for all users.
  813.      If you want to know which users you have reset the flags for, you can
  814.      use a slightly longer "quicky" command file:
  815.  
  816.        if a1 then
  817.          let a1 = 0
  818.          print Name
  819.  
  820.      This will reset the flag for any user whose flag is set, and will
  821.      print out their names.
  822.  
  823.      **** DELETING NON-VERIFIED CALLERS
  824.  
  825.      This second example could be used for nightly maintenance:
  826.  
  827.        \ Delete non-verified callers who haven't called in 5 days
  828.        if level = 10 & today-lastdate > 5
  829.        then
  830.          let deleted = 1
  831.          print name, "is deleted, not verified"
  832.  
  833.      It will delete any user with security level 10 who hasn't called in 5
  834.      days. You will need to use the RAUSER program to actually purge the
  835.      "deleted" user record. Of course, RAUSER will delete users based on
  836.      number of days since last call, but it won't do it for specific
  837.      security levels (just those less than a specified value). Also, this
  838.      example will delete users who have the NOKILL flag set!
  839.  
  840.      If you didn't want to delete users who have NOKILL set, and also
  841.      didn't want to delete already deleted users, the first line could be
  842.      changed to:
  843.  
  844.          if !deleted & !nokill & level = 10 &  today - lastdate > 5
  845.  
  846.  
  847.      User Updater -- Universal                                           17
  848.  
  849.  
  850.  
  851.      **** RAISING LEVELS AND POSTING MESSAGES
  852.  
  853.      This third example raises a user's level and sends a message if a flag
  854.      has been set.  This example and further examples assume the use of
  855.      MBUTIL as the robotic mailer.  MBUTIL is part of the GEcho mail tosser
  856.      program.  However robotic mailers could be used.
  857.  
  858.  
  859.          \ raise level from 20 to 21 if c8 flag set, and send message
  860.          \ to user about the change
  861.          if level=20 & c8
  862.          then
  863.            let level=21
  864.            print name, "has been verified"
  865.            run "mbutil Post verified.txt #1 -To """, name,
  866.                """ -subject Welcome -pvt"
  867.  
  868.      **** LOW CREDITS WARNING
  869.  
  870.      This fourth example sends a warning message when credits drop below a
  871.      certain amount (100 in this case). A flag is used to determine if the
  872.      message has been sent. The flag is reset when credits are restored.
  873.  
  874.          \ For registered users (level 30), send a message if
  875.          \ credits have dropped below 100
  876.          if level = 30 & !c1 & credit - pending < 100
  877.          then
  878.            let c1=1
  879.            run "mbutil Post locredit.txt #1 -To """, name,
  880.                """ -subject Notification -pvt"
  881.          \ Reset flag c1 when credits are again above 100
  882.          if level = 30 & c1 & credit-pending > 100
  883.          then
  884.            let c1=0
  885.  
  886.      **** LIST AND TALLY TERMINAL EMULATIONS
  887.  
  888.      This command file will list which terminal emulation a caller uses.
  889.      The choices are AVATAR, ANSI, or ASCII. The user database is not
  890.      modified.  It will print the total number of users with each setting.
  891.  
  892.          if avt0 \ avatar flag set
  893.          then
  894.            print name, " uses AVATAR"
  895.            let u1 = u1 + 1    \ count AVATAR users
  896.          if ansi & !avt0 \ ansi flag set, but avatar not set
  897.          then
  898.            print name, " uses ANSI"
  899.            let u2 = u2 + 1    \ count ANSI users
  900.          if !(ansi | avt0) \ neither ansi or avatar flag set
  901.          then
  902.            print name, " uses ASCII"
  903.            let u3 = u3 + 1    \ count ASCII users
  904.  
  905.  
  906.      User Updater -- Universal                                           18
  907.  
  908.  
  909.  
  910.          finally \ print totals at end
  911.          if u1 > 0 then print u1, " AVATAR users"
  912.          if u2 > 0 then print u2, " ANSI users"
  913.          if u3 > 0 then print u3, " ASCII users"
  914.  
  915.      **** NOTIFY XMODEM USERS
  916.  
  917.      Would you rather see your callers using ZMODEM protocol rather than
  918.      XMODEM protocol?  This command file will send messages to users who
  919.      use XMODEM!
  920.  
  921.          \ Send a message to all people using Xmodem protocol
  922.          if protocol = 88 then
  923.            run "mbutil Post xmodem.txt #1 -To """, name,
  924.            """ -subject ""XMODEM Usage"" -pvt"
  925.  
  926.      The value 88 is the character "X", so when the default (last used)
  927.      protocol was XMODEM, the robot mailer is called to send a friendly
  928.      suggestion.
  929.  
  930.      **** POSTS PER MONTH RATIO LIST
  931.  
  932.      Lots of programs will show you the posts per call ratio. Would you
  933.      rather know the posts per month ratio?  This command file will do it,
  934.      and won't list callers who have posted fewer than five messages (a
  935.      single post of a first time caller is 30 posts per month!)
  936.  
  937.          if msgpost > 5 then
  938.            print name:20 , msgpost/((today-firstdate)/30) : 5
  939.  
  940.      Do you want to see the list sorted? That's easy! Use the sort
  941.      program that comes with DOS:
  942.  
  943.          u3 postmnth.dat | sort /+21 /r
  944.  
  945.      If you have a DOS version of the Unix (TM Bell Labs) program "tail"
  946.      you can extract the top N callers, and make a custom Top N Caller
  947.      list.
  948.  
  949.      **** POST PER DOWNLOAD RATIO DOOR
  950.  
  951.      This command file is intended for use in Door Mode, to be executed
  952.      automatically at the start of a BBS call. It checks the messages
  953.      posted vs number of files downloaded and set flag A4 if there are more
  954.      messages posted than files downloaded. This flag can then be used to
  955.      control access to file areas. U3 can be run as a type 7 menu item.
  956.  
  957.  
  958.      User Updater -- Universal                                           19
  959.  
  960.  
  961.  
  962.          if msgpost >= downloads \ set flag if good user
  963.          then
  964.            let a4 = 1
  965.          if msgpost < downloads  \ reset flag if bad user
  966.          then
  967.            let a4 = 0
  968.  
  969.      the same two commands could be made part of a nightly maintenance run
  970.      of U3 if it was desirable to alter the flag once per day rather than
  971.      on each call.
  972.  
  973.  
  974.      **** TIME PURCHASE DOOR
  975.  
  976.      This command file is for use in Door Mode, only. It will charge the
  977.      caller 10 credits and in return add 10 minutes of access time during
  978.      the current day.
  979.  
  980.          if credit >= 10 \ must be some credits to spend
  981.          then
  982.            let credit = credit - 10
  983.            let timelimit = timelimit + 10
  984.            let elapsed = elapsed - 10
  985.  
  986.      If some people are allowed credit balances (postbill flag set), then
  987.      this command file should be modified to allow those people to borrow:
  988.  
  989.          if credit >= 10 | postbill
  990.          then
  991.            let credit = credit - 10
  992.            let timelimit = timelimit + 10
  993.            let elapsed = elapsed - 10
  994.  
  995.  
  996.  
  997.  
  998.      **** GENDER BASED DOOR
  999.       
  1000.      Assume a game that has both male and female modes of operation.
  1001.      RemoteAccess  provides no way of running alternate programs depending
  1002.      on gender. The problem is solved with this command file:
  1003.  
  1004.          if sex = 2 then return 2 \ caller is female
  1005.  
  1006.      The game is run from this type 7 menu item batch file:
  1007.  
  1008.  
  1009.      User Updater -- Universal                                           20
  1010.  
  1011.  
  1012.  
  1013.          u3 -u gender.dat
  1014.          if errorlevel 2 goto female
  1015.          game  -Male
  1016.          goto end
  1017.          :female
  1018.          game  -Female
  1019.          :end
  1020.  
  1021.      **** NIGHTLY MAINTENANCE AT BITTER BUTTER BETTER BBS
  1022.  
  1023.      Finally, here is the command file I use for nightly maintenance:
  1024.  
  1025.          if !nokill & ((level < 20 & today-lastdate > 3) |
  1026.            (level < 30 & today-lastdate > 90) |
  1027.            (level < 35 & today-lastdate > 120))
  1028.          then
  1029.            let deleted = 1
  1030.            print "User ", name, ", level ", level,
  1031.                  ", deleted -- no usage"
  1032.          if !deleted & !nokill & today-lastdate > 30 &
  1033.             numcalls = 1 & downloads = 0 & msgpost = 0
  1034.          then
  1035.            let deleted = 1
  1036.            print "User ", name,
  1037.                  " no posts/secondcall/downloads in 30 days"
  1038.          if !deleted & level > 10 & b1=0
  1039.          then
  1040.            let b1 = 1
  1041.            print "User ", name, " Scrabble upgraded"
  1042.  
  1043.  
  1044.      User Updater -- Universal                                           21
  1045.  
  1046.  
  1047.  
  1048.                                 TECHNICAL NOTES
  1049.  
  1050.      I'm always curious about such things, so I'm providing a short
  1051.      technical description of the insides of U3.  U3 is written in C, and
  1052.      compiled with the Borland C++ V4.02 compiler.  The executable program
  1053.      was compacted using Fabrice Bellard's LZEXE.  As mentioned before, U3
  1054.      uses the Ralf Brown's SPAWNO package to swap out of memory in the RUN
  1055.      command.
  1056.  
  1057.      For several years I have done userbase management with C programs that
  1058.      read the userbase, modify the fields as needed, and then write out the
  1059.      changes.  I've also written several programs to obtain statistics of
  1060.      users.  All of these programs are identical in structure.  Of course,
  1061.      each time I wanted to make a change, I had to modify the source and
  1062.      recompile.  I thought, "what if the portion of these programs that
  1063.      differed were separated out and interpreted?  Then the programs would
  1064.      be simpler and easier to maintain." So I proceeded to write U3.
  1065.  
  1066.      If U3 interpreted the command file with each record, performance would
  1067.      be hurt for large user bases.  Indeed, I wanted U3 to run quickly!  So
  1068.      I decided to compile the command file into a "byte code" program that
  1069.      would executed by a runtime byte code interpreter.  This had the added
  1070.      advantage that all syntax errors would be discovered before processing
  1071.      any of the records, rather than taking the risk that an error would
  1072.      not be discovered until the faulty statement was executed.
  1073.  
  1074.      U3 first opens all the files to make certain they are available. Then
  1075.      it compiles the command file.  The compiler is a traditional
  1076.      "recursive descent" design, which is more compact and easier to debug
  1077.      than the more recent table driven techniques.  The compiler was
  1078.      designed to be robust, and to abort on the first error.  While
  1079.      programmers generally prefer to see all error messages at once, most
  1080.      compilers will generate many error message for a single problem,
  1081.      making debugging difficult and discouraging for novices.
  1082.  
  1083.      If the command file compiles without error, records are read one at a
  1084.      time, the interpreter is run to process the record, and, if the record
  1085.      was changed (LET or SET statement executed), the record is written
  1086.      back to the file.  The interpreter implements a "virtual stack
  1087.      machine" which executes 29 different instructions. No attempt was made
  1088.      to make it general; the instruction set was tailored to the
  1089.      application.  Actual referencing of the userbase record is done via
  1090.      table lookup, which will make U3 easy to modify for future version of
  1091.      RemoteAccess.
  1092.  
  1093.  
  1094.      User Updater -- Universal                                           22
  1095.  
  1096.  
  1097.  
  1098.                       OTHER UTILITIES BY THE AUTHOR OF U3
  1099.  
  1100.      ECHOREPT -- GEcho report generator (freeware, with sources)
  1101.      PROCESSI -- Updates download counts in RA 2.0x from
  1102.           FrontDoor/InterMail FREQs (freeware with source)
  1103.      NNANS593 -- NNANSI ANSI.SYS fast/powerful replacement (shareware with
  1104.           source, free non-commercial use)
  1105.      KBDR.COM -- Makes caps lock key a control key (freeware)
  1106.      RESTART -- system configuration manager (freeware with source)
  1107.      RUNIT10 -- Program to spawn DOS VDM's from other DOS VDM's (for OS/2
  1108.           2.0 or later) (Freeware)
  1109.      ALMYUTIL -- text utilities to add/remove tabs and leading spaces from
  1110.           text files.  Also splits large files into smaller files.
  1111.           (freeware)
  1112.      JUSTFY13 -- reformats text files (freeware with source)
  1113.      UNANSI11 -- convert ANSI to vanilla ASCII (freeware with source)
  1114.  
  1115.      All are available from the author's BBS, Bitter Butter Better,
  1116.      503-692-5841, Fidonet FREQ 1:105/290.  FREQ as filename.*.